Learning RxJava by Thomas Nield

Learning RxJava by Thomas Nield
Author: Thomas Nield [Nield, Thomas]
Language: eng
Format: azw3, pdf
Publisher: Packt Publishing
Published: 2017-06-20

ExecutorService


You can build a Scheduler off a standard Java ExecutorService. You may choose to do this in order to have more custom and fine-tuned control over your thread management policies. For example, say, we want to create a Scheduler that uses 20 threads. We can create a new fixed ExecutorService specified with this number of threads. Then, you can wrap it inside a Scheduler implementation by calling Schedulers.from():

import io.reactivex.Observable;

import io.reactivex.Scheduler;

import io.reactivex.schedulers.Schedulers;

import java.util.concurrent.ExecutorService;

import java.util.concurrent.Executors;